home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / LocationManager.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  10.1 KB  |  322 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        LocationManager.p
  3.  
  4.      Contains:    LocationManager (old name; use SettingsManager instead)
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT LocationManager;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __LOCATIONMANAGER__}
  28. {$SETC __LOCATIONMANAGER__ := 1}
  29.  
  30. {$I+}
  31. {$SETC LocationManagerIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __APPLEEVENTS__}
  35. {$I AppleEvents.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __COMPONENTS__}
  38. {$I Components.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __DIALOGS__}
  41. {$I Dialogs.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __PROCESSES__}
  44. {$I Processes.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __STANDARDFILE__}
  47. {$I StandardFile.p}
  48. {$ENDC}
  49.  
  50.  
  51. {$PUSH}
  52. {$ALIGN MAC68K}
  53. {$LibExport+}
  54.  
  55. {  Location Manager API Support --------------------------------------------------------------------  }
  56. {  A Location Token uniquely identifies a Location on a machine...  }
  57.  
  58.  
  59. TYPE
  60.     ALMToken = ^LONGINT;
  61.  
  62. CONST
  63.     kALMNoLocationToken            = -1;                            {  ALMToken of "off" Location... }
  64.  
  65.     kALMLocationNameMaxLen        = 31;                            {  name (actually imposed by file system)...  }
  66.     kALMNoLocationIndex            = -1;                            {  index for the "off" Location (kALMNoLocationToken)...  }
  67.  
  68.  
  69. TYPE
  70.     ALMLocationName                        = Str31;
  71. {  Returned from ALMConfirmName...  }
  72.     ALMConfirmChoice                    = SInt16;
  73.  
  74. CONST
  75.     kALMConfirmRename            = 1;
  76.     kALMConfirmReplace            = 2;
  77.  
  78. {  ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)...  }
  79.  
  80.     kALMDuplicateRenameButton    = 1;                            {  if Window refcon is kALMDuplicateDialogRefCon...  }
  81.     kALMDuplicateReplaceButton    = 2;
  82.     kALMDuplicateCancelButton    = 3;
  83.     kALMDuplicatePromptText        = 5;
  84.  
  85.     kALMRenameRenameButton        = 1;                            {  if Window refcon is kALMRenameDialogRefCon...  }
  86.     kALMRenameCancelButton        = 2;
  87.     kALMRenameEditText            = 3;
  88.     kALMRenamePromptText        = 4;
  89.  
  90. {  Refcons of two windows in ALMConfirmName (ALM 2.0)...  }
  91.  
  92.     kALMDuplicateDialogRefCon    = 'dupl';
  93.     kALMRenameDialogRefCon        = 'rnam';
  94.  
  95. {  Callback routine for Location awareness (mimics AppleEvents) in non-application code...  }
  96.  
  97.  
  98. TYPE
  99. {$IFC TYPED_FUNCTION_POINTERS}
  100.     ALMNotificationProcPtr = PROCEDURE(VAR theEvent: AppleEvent);
  101. {$ELSEC}
  102.     ALMNotificationProcPtr = ProcPtr;
  103. {$ENDC}
  104.  
  105.     ALMNotificationUPP = UniversalProcPtr;
  106.  
  107. CONST
  108.     uppALMNotificationProcInfo = $000000C0;
  109.  
  110. FUNCTION NewALMNotificationProc(userRoutine: ALMNotificationProcPtr): ALMNotificationUPP;
  111.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  112.     INLINE $2E9F;
  113.     {$ENDC}
  114.  
  115. PROCEDURE CallALMNotificationProc(VAR theEvent: AppleEvent; userRoutine: ALMNotificationUPP);
  116.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  117.     INLINE $205F, $4E90;
  118.     {$ENDC}
  119. {  Notification AppleEvents sent to apps/registered code...   }
  120.  
  121. CONST
  122.     kAELocationChangedNoticeKey    = 'walk';                        {  Current Location changed...  }
  123.     kAELocationRescanNoticeKey    = 'trip';                        {  Location created/renamed/deleted...  }
  124.  
  125. {  ALMSwitchToLocation masks...  }
  126.  
  127.  
  128. TYPE
  129.     ALMSwitchActionFlags                = SInt32;
  130.  
  131. CONST
  132.     kALMDefaultSwitchFlags        = $00000000;                    {  No special action to take...  }
  133.     kALMDontShowStatusWindow    = $00000001;                    {  Suppress "switching" window...  }
  134.     kALMSignalViaAE                = $00000002;                    {  Switch by sending Finder AppleEvent...  }
  135.  
  136. {  Parameters for Get/Put/Merge Location calls...  }
  137.  
  138.  
  139. TYPE
  140.     ConstALMModuleTypeListPtr            = ^OSType;
  141.  
  142. CONST
  143.     kALMAddAllOnSimple            = 0;                            {  Add all single-instance, non-action modules...  }
  144.     kALMAddAllOff                = -1;                            {  Add all modules but turn them off...  }
  145.  
  146. {  Item numbers for use in Get/Put/Merge Location filters...  }
  147.  
  148.     kALMLocationSelectButton    = 1;
  149.     kALMLocationCancelButton    = 2;
  150.     kALMLocationBalloonHelp        = 3;
  151.     kALMLocationLocationList    = 7;
  152.     kALMLocationLocationNameEdit = 10;
  153.     kALMLocationPromptText        = 11;
  154.  
  155.     kALMLocationSaveButton        = 1;
  156.  
  157. {  Location Manager Module API Support -------------------------------------------------------------  }
  158.  
  159. {  ALMGetScriptInfo stuff...  }
  160.  
  161.     kALMScriptInfoVersion        = 2;                            {  Customarily put in resource for localization...  }
  162.  
  163.  
  164. TYPE
  165.     ALMScriptManagerInfoPtr = ^ALMScriptManagerInfo;
  166.     ALMScriptManagerInfo = RECORD
  167.         version:                SInt16;                                    {  Set to kALMScriptInfoVersion...  }
  168.         scriptCode:                SInt16;
  169.         regionCode:                SInt16;
  170.         langCode:                SInt16;
  171.         fontNum:                SInt16;
  172.         fontSize:                SInt16;
  173.     END;
  174.  
  175. {
  176.    Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  177.    samples and internally, so....
  178. }
  179.     ALMAltScriptManagerInfoPtr = ^ALMAltScriptManagerInfo;
  180.     ALMAltScriptManagerInfo = RECORD
  181.         version:                SInt16;
  182.         scriptCode:                SInt16;
  183.         regionCode:                SInt16;
  184.         langCode:                SInt16;
  185.         fontSize:                SInt16;
  186.         fontName:                Str63;
  187.     END;
  188.  
  189.     ALMAltScriptManagerInfoHandle        = ^ALMAltScriptManagerInfoPtr;
  190.  
  191. CONST
  192.     kALMAltScriptManagerInfoRsrcType = 'trip';
  193.     kALMAltScriptManagerInfoRsrcID = 0;
  194.  
  195. {  Reboot information used on ALMSetCurrent (input/output parameter)...  }
  196.  
  197.  
  198. TYPE
  199.     ALMRebootFlags                        = UInt32;
  200.  
  201. CONST
  202.     kALMNoChange                = 0;
  203.     kALMAvailableNow            = 1;
  204.     kALMFinderRestart            = 2;
  205.     kALMProcesses                = 3;
  206.     kALMExtensions                = 4;
  207.     kALMWarmBoot                = 5;
  208.     kALMColdBoot                = 6;
  209.     kALMShutdown                = 7;
  210.  
  211. {
  212.    File types and signatures...
  213.    Note: auto-routing of modules will not be supported for 'thng' files...
  214. }
  215.  
  216.     kALMFileCreator                = 'fall';                        {  Creator of Location Manager files...  }
  217.     kALMComponentModuleFileType    = 'thng';                        {  Type of a Component Manager Module file [v1.0]...  }
  218.     kALMComponentStateModuleFileType = 'almn';                    {  Type of a CM 'state' Module file...  }
  219.     kALMComponentActionModuleFileType = 'almb';                    {  Type of a CM 'action' Module file...  }
  220.     kALMCFMStateModuleFileType    = 'almm';                        {  Type of a CFM 'state' Module file...  }
  221.     kALMCFMActionModuleFileType    = 'alma';                        {  Type of a CFM 'action' Module file...  }
  222.  
  223. {  Component Manager 'thng' info...  }
  224.  
  225.     kALMComponentRsrcType        = 'thng';
  226.     kALMComponentType            = 'walk';
  227.  
  228. {  CFM Modules require a bit of information (replacing some of the 'thng' resource)...  }
  229.  
  230.     kALMModuleInfoRsrcType        = 'walk';
  231.     kALMModuleInfoOriginalVersion = 0;
  232.  
  233. {  These masks apply to the "Flags" field in the 'thng' or 'walk' resource...  }
  234.  
  235.     kALMMultiplePerLocation        = $00000001;                    {  Module can be added more than once to a Location...  }
  236.     kALMDescriptionGetsStale    = $00000002;                    {  Descriptions may change though the setting didn't...   }
  237.  
  238. {  Misc stuff for older implementations ------------------------------------------------------------  }
  239.  
  240. {$IFC OLDROUTINENAMES }
  241. {  Old error codes for compatibility - new names are in Errors interface...  }
  242.     ALMInternalErr                = -30049;                        {  use kALMInternalErr  }
  243.     ALMLocationNotFound            = -30048;                        {  use kALMLocationNotFoundErr  }
  244.     ALMNoSuchModuleErr            = -30047;                        {  use kALMNoSuchModuleErr  }
  245.     ALMModuleCommunicationErr    = -30046;                        {  use kALMModuleCommunicationErr  }
  246.     ALMDuplicateModuleErr        = -30045;                        {  use kALMDuplicateModuleErr  }
  247.     ALMInstallationErr            = -30044;                        {  use kALMInstallationErr  }
  248.     ALMDeferSwitchErr            = -30043;                        {  use kALMDeferSwitchErr  }
  249.  
  250. {  Old ALMConfirmName constants...  }
  251.  
  252.     ALMConfirmRenameConfig        = 1;
  253.     ALMConfirmReplaceConfig        = 2;
  254.  
  255. {  Old AppleEvents...  }
  256.  
  257.     kAELocationNotice            = 'walk';
  258.  
  259.  
  260. TYPE
  261.     ALMScriptMgrInfo                    = ALMScriptManagerInfo;
  262.     ALMScriptMgrInfoPtr                 = ^ALMScriptMgrInfo;
  263.     ALMComponentFlagsEnum                = UInt32;
  264. {$ENDC}  {OLDROUTINENAMES}
  265.  
  266. {  Location Manager API ----------------------------------------------------------------------------  }
  267.  
  268. {  The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set...  }
  269.  
  270. FUNCTION ALMGetCurrentLocation(VAR index: SInt16; VAR token: ALMToken; VAR name: ALMLocationName): OSErr;
  271.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  272.     INLINE $303C, $0600, $AAA4;
  273.     {$ENDC}
  274. FUNCTION ALMGetIndLocation(index: SInt16; VAR token: ALMToken; VAR name: ALMLocationName): OSErr;
  275.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  276.     INLINE $303C, $0501, $AAA4;
  277.     {$ENDC}
  278. FUNCTION ALMCountLocations(VAR locationCount: SInt16): OSErr;
  279.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  280.     INLINE $303C, $0202, $AAA4;
  281.     {$ENDC}
  282. FUNCTION ALMSwitchToLocation(newLocation: ALMToken; switchFlags: ALMSwitchActionFlags): OSErr;
  283.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  284.     INLINE $303C, $0403, $AAA4;
  285.     {$ENDC}
  286. FUNCTION ALMRegisterNotifyProc(notificationProc: ALMNotificationUPP; {CONST}VAR whichPSN: ProcessSerialNumber): OSErr;
  287.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  288.     INLINE $303C, $0404, $AAA4;
  289.     {$ENDC}
  290. FUNCTION ALMRemoveNotifyProc(notificationProc: ALMNotificationUPP; {CONST}VAR whichPSN: ProcessSerialNumber): OSErr;
  291.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  292.     INLINE $303C, $0405, $AAA4;
  293.     {$ENDC}
  294. FUNCTION ALMConfirmName(message: Str255; VAR theName: Str255; VAR choice: ALMConfirmChoice; filter: ModalFilterUPP): OSErr;
  295.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  296.     INLINE $303C, $0806, $AAA4;
  297.     {$ENDC}
  298. {  The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set...  }
  299.  
  300. FUNCTION ALMPutLocation(prompt: Str255; VAR name: ALMLocationName; numTypes: SInt16; typeList: ConstALMModuleTypeListPtr; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  301.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  302.     INLINE $303C, $0B07, $AAA4;
  303.     {$ENDC}
  304. FUNCTION ALMGetLocation(prompt: Str255; VAR name: ALMLocationName; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  305.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  306.     INLINE $303C, $0808, $AAA4;
  307.     {$ENDC}
  308. FUNCTION ALMMergeLocation(prompt: Str255; VAR name: ALMLocationName; numTypes: SInt16; typeList: ConstALMModuleTypeListPtr; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  309.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  310.     INLINE $303C, $0B09, $AAA4;
  311.     {$ENDC}
  312. {$ALIGN RESET}
  313. {$POP}
  314.  
  315. {$SETC UsingIncludes := LocationManagerIncludes}
  316.  
  317. {$ENDC} {__LOCATIONMANAGER__}
  318.  
  319. {$IFC NOT UsingIncludes}
  320.  END.
  321. {$ENDC}
  322.